Micron Document
Deavmi's coding shack

Commit 863266e41e66ad974830880ee2f006d6f8e42a65


Parents : 6a63c4b
Author : Tristan B. Kildaire <deavmi@redxen.eu>
Date : 2021-05-31T18:39:56+02:00

Added documentation on structs

Changes

1 files changed, 42 insertions(+), 0 deletions(-)


Diff

diff --git a/new_docs/content/documentation/structs.md b/new_docs/content/documentation/structs.md
new file mode 100644
index 0000000..3ad5c4a
--- /dev/null
+++ b/new_docs/content/documentation/structs.md
@@ -0,0 +1,42 @@
+---
+title: Structs
+tags: [structs]
+date: 2021-05-31
+---
+
+# Introduction
+
+What are structs? In T a Struct is a user-defined type which associates several fields toghether however, unlike C, structs in T can have a set of functions associated with them as well.
+
+The syntax for declaring a struct with name `<name>`, and some fields `<field1>`, `<field2>` with the types `<type1>`, `type2>` respectively is as follows:
+
+```
+struct <name>
+{
+ <type1> <field1>;
+ <type2> <field2>;
+}
+```
+
+Note: Assignments to these variables within the struct's body is not allowed.
+
+## Example
+
+Perhaps we want a simple struct that associates a name, age and gender together to represent a _Person_, then we can declare such a struct as follows:
+
+```
+struct Person
+{
+ char* name;
+ ubyte age;
+ ubyte gender;
+}
+```
+
+---
+
+# Member functions
+
+TODO: Add this
+
+## Example
\ No newline at end of file

Served by rngit 1.5.0 - Generated in 0.04s